package com.yvan.demo.web1.controller;

import com.yvan.PageDb;
import com.yvan.demo.common.entity.SysWh;
import com.yvan.demo.platform.Model;
import com.yvan.demo.web1.entity.IdRule;
import com.yvan.demo.web1.service.IdRuleService;
import com.yvan.demo.web1.service.SysWhService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class CommonController {

    @Autowired
    private SysWhService sysWhService;

    @Autowired
    private IdRuleService idRuleService;

    @GetMapping("/common/whData.json")
    public Model<List<SysWh>> whData() {
        List<SysWh> r = sysWhService.selectActive();
        return Model.newSuccess(r);
    }

    @GetMapping("/common/idRuleData.json")
    public Model<List<IdRule>> idRuleData(PageDb pageDb) {
        List<IdRule> r = idRuleService.selectActive(pageDb);
        return Model.newSuccess(pageDb, r);
    }
}
